﻿// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_SALES_RETURN_ITEM
// * CreateDate    : 2013/1/14 15:42:00
// * Creater       : SalesReturnItemBs
// * LastChangeDate: 2013/1/14 15:42:00
// * LastChanger   : 2013/1/14 15:42:00
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;

namespace ESOL.Business.Sales
{
    /// <summary>
    /// SalesReturnItem
    /// </summary>
    public partial class SalesReturnItemBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objSalesReturnItemEntity">Entity</param>
        /// <returns>Entity</returns>
        public static SalesReturnItemEntity GetSalesReturnItem(SalesReturnItemEntity objSalesReturnItemEntity)
        {
            return DataAccess.SelectSingle<SalesReturnItemEntity>(objSalesReturnItemEntity);
        }
        public static DataSet GetSalesReturnItemsByReturnOrderId(string ReturnOrderId)
        {
            string sql = @"select A.*,B.*,C.PRICE from dbo.SALES_RETURN_ITEM A
                           inner join dbo.MST_PRODUCT B ON A.PRODUCT_ID=B.PRODUCT_ID
                           INNER JOIN dbo.SALES_PROD_PLAN_APPLICATION_ITEM C ON A.SALES_PROD_PLAN_APPLICATION_ITEM_ID=C.APPLICATION_ITEM_ID
                           where A.SALES_RETURN_ORDER_ID='" + ReturnOrderId + "'";
            DataSet ds = DataAccess.SelectDataSet(sql);
            return ds;
        }
        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objSalesReturnItemEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertSalesReturnItem(SalesReturnItemEntity objSalesReturnItemEntity)
        {
            return DataAccess.Insert(objSalesReturnItemEntity);
        }

        public static bool InsertSalesReturnItem(List<SalesReturnItemEntity> objSalesReturnItemEntityList)
        {
            return DataAccess.Insert(objSalesReturnItemEntityList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objSalesReturnItemEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateSalesReturnItem(SalesReturnItemEntity objSalesReturnItemEntity)
        {
            return DataAccess.Update(objSalesReturnItemEntity);
        }

        public static bool UpdateSalesReturnItem(List<SalesReturnItemEntity> objSalesReturnItemEntityList)
        {
            return DataAccess.Update<SalesReturnItemEntity>(objSalesReturnItemEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objSalesReturnItemEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteSalesReturnItem(SalesReturnItemEntity objSalesReturnItemEntity)
        {
            return DataAccess.Delete(objSalesReturnItemEntity);
        }

        public static bool DeleteSalesReturnItem(List<SalesReturnItemEntity> objSalesReturnItemEntityList)
        {
            return DataAccess.Delete<SalesReturnItemEntity>(objSalesReturnItemEntityList);
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetSalesReturnItemAll()
        {
            return DataAccess.SelectAllDataSet<SalesReturnItemEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<SalesReturnItemEntity> GetSalesReturnItemAllList()
        {
            return DataAccess.SelectAll<SalesReturnItemEntity>();
        }
        #endregion
    }


}

